//Copyright (c) Microsoft Corporation.  All rights reserved.

using System;
using System.Collections.Generic;
using System.Text;
using Eas.WebCrawler.Model.Core;

namespace Eas.WebCrawler.Model.Actions {
    internal class TerminalAction : ProcessingAction{
        #region Action Members

        public IAsyncResult BeginAction(WorkerContext context, BaseProcessingState state, AsyncCallback callback) {
            state.SetTerminated();
            return null;
        }

        public void PerformCompletingAction(WorkerContext context, BaseProcessingState state, IAsyncResult result) {
            throw new InvalidOperationException("PerformCompletingAction should never be called on a Terminal Action.");
        }

        public ProcessingAction EndAction(WorkerContext context, BaseProcessingState state, IAsyncResult result) {
            throw new InvalidOperationException ("EndAction should never be called on a Terminal Action.");
        }

        public Eas.WebCrawler.Interfaces.WorkerState WorkerState {
            get { return Eas.WebCrawler.Interfaces.WorkerState.Stopped; }
        }

        public ActionId ActionId {
            get { return ActionId.Terminal; }
        }

        #endregion
    }
}
